public class ProxySearch implements  Searcher{
    private RealSearcher searcher =new RealSearcher();
    private AccessValidator validator;
    private Logger logger;

    @Override
    public String dosearch(String userId, String keyword) {
        if(this.validator(userId)){
            String result=searcher.dosearch(userId,keyword);
            this.log(userId);

            return result;
        }
        else return null;
    }

    public boolean validator(String userId){
        validator =new AccessValidator();
        return validator.validate(userId);
    }
    public void log(String userId){
        logger=new Logger();
        logger.log(userId);

    }

}
